﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TinyCinema.UI.Pages.Report.CinemaReport
{
    /// <summary>
    /// Interaction logic for Report2.xaml
    /// </summary>
    public partial class Report2 : Page
    {
        public StackPanel MainMenu { get; set; }
        public static Reports.Cinema.Report2 dataContext = new Reports.Cinema.Report2();
        public Report2()
        {
            InitializeComponent();
            MainMenu = FindResource("MainMenu") as StackPanel;
            crvReportViewer.ToggleSidePanel = SAPBusinessObjects.WPF.Viewer.Constants.SidePanelKind.None;
            Loaded += Report2_Loaded;
        }

        void Report2_Loaded(object sender, RoutedEventArgs e)
        {
            crvReportViewer.ViewerCore.ReportSource = dataContext.Load(Login.dataContext);
        }
        private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            crvReportViewer.ViewerCore.Zoom((int)(sender as Slider).Value);
        }

        private void MenuHandle(object sender, RoutedEventArgs e)
        {
            switch ((sender as Button).Uid)
            {
                case "Print": crvReportViewer.ViewerCore.PrintReport();
                    break;
                case "Export": crvReportViewer.ViewerCore.ExportReport();
                    break;
                case "Reload": crvReportViewer.ViewerCore.ReportSource = dataContext.Load(Login.dataContext);
                    break;
                case "PageNext": crvReportViewer.ViewerCore.ShowNextPage();
                    break;
                case "PagePrevious": crvReportViewer.ViewerCore.ShowPreviousPage();
                    break;
            }
        }
    }
}
